package algorithms;

/**
 * @author lizen
 */
public class PalindromeCheck {
    public static boolean isPalindrome(String content) {
        int stringLength = content.length();
        int start = 0, tail = stringLength - 1;
        boolean isTrue = true;

        while( start < tail ) {
            char startChar = content.charAt(start);
            char tailChar = content.charAt(tail);

            if (startChar != tailChar) {
                isTrue = false;
                break;
            }

            start++;
            tail--;
        }

        return isTrue;
    }

    public static void test() {
        String content = "abcba";
        System.out.println(isPalindrome(content));
    }
}
